﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AppForm_Managers.Ultis_Code
{
    class RenameImage
    {
        public static String RenameImageURL(String oldName, int length)
        {
            Random rd = new Random();
            String[] ch = { "q","w","e","r","t","y","u","i","o","p","a","s","d","f","g",
                          "h","j","k","l","z","x","c","v","b","n","m","Q","W","E","R",
                          "T","Y","U","U","O","P","A","S","D","F","G","H","J","K","K",
                          "Z","X","C","V","B","N","M","_","0","1","2","3","4","5",
                          "6","7","8","9","_","_","_","_","_","_","_","_"
                      };
            int dot = oldName.LastIndexOf('.');
            String sub = oldName.Substring(dot, (oldName.Length - dot));
            String result = "";
            for (int i = 0; i < length; i++)
            {
                result += ch[rd.Next(ch.Length)];
            }
            return result + sub;
        }
    }
}
